import request from '../utils/request';

/**
 * 查询考勤列表分页
 * @param query
 * @returns {AxiosPromise}
 */
export const selectPage = query => {
    return request({
        url: 'rest/attendance/selectPage',
        method: 'POST',
        data: query
    });
};

/**
 * 新增考勤
 * @param query
 * @returns {AxiosPromise}
 */
export const addAttendance = query => {
    return request({
        url: 'rest/attendance/insert',
        method: 'POST',
        data: query
    });
};

/**
 * 编辑考勤
 * @param query
 * @returns {AxiosPromise}
 */
export const updateAttendance = query => {
    return request({
        url: 'rest/attendance/update',
        method: 'POST',
        data: query
    });
};

/**
 * 删除考勤
 * @param query
 * @returns {AxiosPromise}
 */
export const delAttendance = query => {
    return request({
        url: 'rest/attendance/delete',
        method: 'POST',
        data: query
    });
};

/**
 * 查询单条人员考勤
 * @param query
 * @returns {AxiosPromise}
 */
export const getAttendanceByID = query => {
    return request({
        url: 'rest/attendance/getById/' + query,
        method: 'POST',
    });
};

/**
 * 导入
 * @param query
 * @returns {AxiosPromise}
 */
export const uploadExcel = query => {
    return request({
        url: 'rest/attendance/uploadExcel',
        headers: {
            'Content-Type': 'multipart/form-data',
        },
        method: 'POST',
    });
};